/*
 * @Author: your name
 * @Date: 2020-02-01 09:26:41
 * @LastEditTime: 2020-03-15 23:17:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-ele-env\src\views\RCIM-archives\mixins\control.js
 */
import {
	cloneDeep
} from 'lodash';

export default {
	data() {
		return {
			dialogFormVisible: false,
			listQuery: {
				page: 1,
				limit: 10,
				id: ""
			},
		}
	},
	model: {
		prop: 'entData',
		event: 'addEnter'
	},
	props: {
		showDetail: {
			type: Boolean,
			default: () => false
		},
		entData: {
			type: Object,
			default: () => ({})
		}
	},
	watch: {
		showDetail(val) {
			this.$refs.formDelg?.openDialog();
			this.initShowDetail&&this.initShowDetail(val)
		},
		entData(val) {
			this.listQuery.id = val.id
		}
	},
	mounted() {},
	methods: {
		closeDialog() {
			// debugger
			// this.$emit("closeDetail", false)
			// this.dialogFormVisible = false;
			this.editInfo = {}
		},
		fresh() {
			this.$refs.formDelg.closeDialog();
			this.getList()
		},
		handleInfo(infoObject) { // 处理获取实例信息，与formList的数据的匹配
			if (!infoObject || (typeof infoObject != 'object')) return
			let copyList = cloneDeep(this.formList)
				copyList.map(v => {
					v.list.map(n => {
						n.defaultValue = infoObject[n.moduleKey]
						return n
					})
					return v
				})
				console.log(copyList);

				return copyList
		}
	}

}
